import api from "@/api";

// 首页数据
export async  function getHomeBase(){
    let res = await api({url:'/api/index/index', method:'post'})
    return res.data
}

// 用户登录
export async function LoginApi(data){
    let res = await api({url:'/api/user/login',method:'post',data})
    return res.data
}

// 用户注册
export async function userRegister(data){
    let res = await api({url:'/api/user/register',method:'post',data})
    return res.data
}

// 修改头像
export async function userProfile(data){
    let res = await api({url:'/api/user/profile',method:'post',data})
    return res.data
}
// 查询个人信息
export async function getUserInfo(){
    let res = await api({url:'/api/user/index',method:'post'})
    return res.data
}
// 退出登录
export async function loginOut(data){
    let res = await api({url:'/api/user/logout',method:'post',data})
    return res.data
}

// 重置登录密码
export async function updateLoginPwd(data){
    let res = await api({url:'/api/user/change',method:'post',data})
    return res.data
}



// 发送验证码
export async function sendCode(data){
    let res = await api({url:'/api/ems/send',method:'get',params:data})
    return res.data
}
// 更改订单状态
export async function editStatus(id,status,username,amount,orderNum){
    let res = await api({method:'get', params :{id:id,orderStatus:status,username:username,transactionAmount:amount,orderNum:orderNum}, url:`/h5Api/order/editStatus`,})
    return res
}

// 获取充值列表
export async function getRechargeList(){
    let res = await api({method:'get', url:`/api/user/recharge_list`,})
    return res.data
}
// 获取协议
export async function obtainProtocol(){
    let res = await api({method:'get', url:`/api/merchant/index`,})
    return res.data
}
// 商家入驻
export async function merchantSettlement(data){
    let res = await api({method:'post', url:`/api/merchant/reg`,data:data})
    return res.data
}


// 首页接口
export async function homePageData(){
    let res = await api({
        method:'post',
        url:'/api/index/index'
    })
    return res
}

// 商品
export async function productList(data){
    let res = await api({
        method:'post',
        url:'/api/index/pro',
        data
    })
    return res
}
// 店铺详情
export async function shopDetails(data){
    let res = await api({
        method:'post',
        url:'/api/index/shop_info',
        data
    })
    return res
}

// 上传用户头像
export async  function accountAvatarUpload(params){
    let res = await api({
        url:'/api/index/upload',
        method:'post',
        data: params,
        headers: {
            "Content-Type": "multipart/form-data;charset=UTF-8"
        }
    })
    return res.data
}

//商品搜索
export async function productSearch(data){
    let res = await  api({
        method:'post',
        url:'/api/index/search_pro',
        data
    })
    return res
}
//商品搜索
export async function shopSearch(data){
    let res = await  api({
        method:'post',
        url:'/api/index/search_shop',
        data
    })
    return res
}

export async function getGoodsDetail(data){
    let res = await  api({
        method:'post',
        url:'/api/index/pro_info',
        data
    })
    return res
}
export async function getArticleList(ids){
    let res = await  api({
        method:'get',
        url:'/api/Article/category',
        params:{ids}
    })
    return res
}
export async function getArticleDetail(id){
    let res = await  api({
        method:'get',
        url:'/api/Article/detail',
        params:{
            article_id:id
        }
    })
    return res
}
export async function getMerchantInfo(){
    let res = await  api({
        method:'post',
        url:'/api/merchant/index',
    })
    return res
}
export async function getUerFavStores(){
    let res = await  api({
        method:'post',
        url:'/api/user/followers_list',
    })
    return res
}
export async function requestFollowStoreApi(data){
    let res = await  api({
        method:'post',
        url:'/api/user/followers',
        data
    })
    return res
}
export async function addEditAddress(data){
    let res = await  api({
        method:'post',
        url:'/api/aera/addEdit',
        data
    })
    return res
}
export async function getAddress(data){
    let res = await  api({
        method:'post',
        url:'/api/aera/index',
        data
    })
    return res
}
export async function removeAddress(data){
    let res = await  api({
        method:'post',
        url:'/api/aera/del',
        data
    })
    return res
}
export async function getDefaultArea(data){
    let res = await  api({
        method:'post',
        url:'/api/aera/readArea',
        data
    })
    return res
}


